/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package AdminDB;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class WaitMessage {

    private Shell shell;
    private Font font;
    private Color color;

    public WaitMessage(Shell shell, String msg) {
    	Display display = shell.getDisplay();
        this.shell = shell;
        this.font = new Font(display, "Calibri", 18, SWT.NORMAL);
        this.color = new Color(display, 255, 255, 255);
        shell.setBounds(400, 450, 310, 50);
        shell.setLayout(new GridLayout(1,false));
        shell.setBackground(color);
        Label text = new Label(shell, SWT.CENTER);
        text.setBackground(color);
        text.setFont(font);
        text.setText(msg);
        text.setAlignment(SWT.CENTER) ;

        GridData gridData = new GridData();
        gridData.horizontalAlignment = GridData.CENTER;
        gridData.grabExcessHorizontalSpace = true;
        gridData.grabExcessVerticalSpace = true;
        text.setLayoutData(gridData);

    }

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display, SWT.NO_REDRAW_RESIZE);
        new WaitMessage(shell, "Waiting for database...");
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    }


}
